<a href="<?php echo( base_url() ); ?>cmb/member_reports/download_management_dashboard_report/<?php echo( $urlKey ); ?>/" target="_self">Download Data</a>
<?php
	Includes::IncludeFile( Includes::$FORM );
	Includes::IncludeFile( Includes::$SPACER );
	
	Spacer::Render(0, 20);

	$curdatetime = time();
	
	$curdate = date('l, F jS, Y', $curdatetime);
	Form::OpenFormItemSummary('Date:', 50);
		echo( form_label($curdate, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();

	$curtime = date('h:i:s A', $curdatetime);
	Form::OpenFormItemSummary('Time:', 50);
		echo( form_label($curtime, 'numrecs', 'style="width: 50px;" ') );
	Form::CloseFormItem();
	Form::OpenFormItemSummary('School Year:', 100);
		echo( form_label($curyear.'-'.($curyear+1), 'numrecs', 'style="width: 20px;" ') );
	Form::CloseFormItem();
	echo('<hr style="width:50%; size:10; color:#0000FF;" align="left" />');	

	Spacer::Render(0, 10);
		
	if (count($dashinfoarr) > 0)
	{
		Spacer::Render(0, 3);
		Form::OpenFormItemSummary('<b>Balavihar Class Summary<b>', 200);
		Form::CloseFormItem();
		
		echo('<table border="1">');
		
		//Write header
		echo('<th>Center</th>');
		echo('<th>Session</th>');
		echo('<th>Prev Grade</th>');
		echo('<th>Curr Grade</th>');
		echo('<th>#Prev</th>');
		echo('<th>#Curr</th>');
		echo('<th>#Common</th>');
		echo('<th>#Drop Out</th>');
		echo('<th>%Drop Out</th>');
		echo('<th>#New</th>');
		echo('<th>%Attendance</th>');

		$i = 0;
		foreach($dashinfoarr as $dashrec)
		{
			if ($i % 2 != 0)
			{
				$rowColor = "#e0ffff";
			}
			else
			{
				$rowColor = "#ffffff";
			}
            
            if ($dashrec[0] == 'Andover')
            {
                if (intval($dashrec[5]) >= $this->config->item('max_class_size'))
                    $rowColor = "#ff6633";
            }
            else
            {
                if (intval($dashrec[5]) >= $this->config->item('max_class_size_mw'))
                    $rowColor = "#ff6633";                
            }

			if ($dashrec[4] > 0)
				$percentdo = floor(100.0*$dashrec[7]/$dashrec[4]);
			else
				$percentdo = 0;
			
			if ($dashrec[10] > 0)
				$percentatt = floor(100.0*$dashrec[9]/$dashrec[10]);
			else
				$percentatt = 0;
			
			echo('<tr bgcolor="'.$rowColor.'"> <td>'.$dashrec[0].'</td><td>'.$dashrec[1].'</td><td>'.$dashrec[2].'</td><td>'.$dashrec[3].'</td><td>'.$dashrec[4].'</td><td>'.$dashrec[5].'</td><td>'.$dashrec[6].'</td><td>'.$dashrec[7].'</td><td>'.$percentdo.'%</td><td>'.$dashrec[8].'</td><td>'.$percentatt.'%</td></tr>');

			$i++;
		}
		
		echo('</table>');
	}
	else
		echo("No results</br>");
?>
